From: Florian Müllner Date: Sun, 9 Jul 2023 10:47:05 +0000 (+0200) Subject: dbusServices/extensions: Don't use getCurrentExtension() X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~337^2~1^2~128 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=9e4de6a0058a9987d1a3ef178bd29229f1a7c354;p=gnome-shell.git dbusServices/extensions: Don't use getCurrentExtension() The prefs dialog is created on behalf of a particular extension. It's a bit silly to rely on getCurrentExtension() to access it, instead of just keeping track of it ourselves. Part-of: --- diff --git a/js/dbusServices/extensions/extensionPrefsDialog.js b/js/dbusServices/extensions/extensionPrefsDialog.js index 404cbbeac..01c4a5c20 100644 --- a/js/dbusServices/extensions/extensionPrefsDialog.js +++ b/js/dbusServices/extensions/extensionPrefsDialog.js @@ -18,20 +18,24 @@ export const ExtensionPrefsDialog = GObject.registerClass({ search_enabled: false, }); - this._loadPrefs(extension).catch(e => { + this._extension = extension; + + this._loadPrefs().catch(e => { this._showErrorPage(e); logError(e, 'Failed to open preferences'); }); } - async _loadPrefs(extension) { + async _loadPrefs() { // give extension prefs access to their own extension object - ExtensionUtils.setCurrentExtension(extension); + ExtensionUtils.setCurrentExtension(this._extension); + + const {dir, metadata} = this._extension; - const prefsJs = extension.dir.get_child('prefs.js'); + const prefsJs = dir.get_child('prefs.js'); const prefsModule = await import(prefsJs.get_uri()); - const prefsObj = new prefsModule.default(extension.metadata); + const prefsObj = new prefsModule.default(metadata); prefsObj.fillPreferencesWindow(this); if (!this.visible_page) @@ -56,8 +60,7 @@ export const ExtensionPrefsDialog = GObject.registerClass({ while (this.visible_page) this.remove(this.visible_page); - const extension = ExtensionUtils.getCurrentExtension(); - this.add(new ExtensionPrefsErrorPage(extension, e)); + this.add(new ExtensionPrefsErrorPage(this._extension, e)); } });